package externalflame.systemdesign.newsfeed.controller;

import externalflame.systemdesign.newsfeed.entity.Tweet;
import externalflame.systemdesign.newsfeed.service.TweetService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("timeline")
public class TimelineController {

    @Autowired
    TweetService tweetService;

    @ApiOperation("时间线")
    @GetMapping(value = "/", produces = "application/json")
    public List<Tweet> getTimeLine(@RequestParam("userId") Long userId, @RequestParam("maxId") Long maxId, @RequestParam("pageSize") Long pageSize) {
        return tweetService.getTimeline(userId, maxId, pageSize);
    }
}
